Skip to main content

Parent and Child variable

In Glific, one flow can be linked to another flow. The main flow in this case is the parent flow and the linked on is the child flow.

Variables defined in Parent flow can be accessed in child flow and vice versa.

In below example, two flows are created. We will see how to access variables across flows.

  1. Parent
  2. Child

Access variable in child flow, which was defined in parent flow

Parent flow has variable defined with name state

1 . Create a flow (parent).

image

2 . Define a variable. In this example the variable name is state

image

3 . Call another flow (child)

image

4 . Access variable created in parent flow.

Syntax to access any variable of parent flow is @results.parent.variablename like in this example the variable name is state . The syntax will be @results.parent.state.input

image

Access variable in parent flow , which was defined in child flow.

1 . Define a variable in child flow. In this example the variable name is City

image

2 . Access the variable in parent flow.

Syntax to access any variable of child flow is @results.child.variablename like in this example the variable name is city . The syntax will be

@results.child.city.input

image

Your Parent and Child flows will look like this

Parent Flow

image

Child Flow

image

Flow results will look like

image